package com.zan.rocketmqbootconsumer.listener;

import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * @Author Zan
 * @Create 2024/8/30 10:07
 * @ClassName: KeyMsgListener
 * @Description : TODO 请用一句话描述该类的功能
 */
@Component
@RocketMQMessageListener(topic = "bootKeyTopic", consumerGroup = "test-key-consumer")
public class KeyMsgListener implements RocketMQListener<MessageExt> {
    @Override
    public void onMessage(MessageExt message) {
        String keys = message.getKeys();
        System.out.println(keys);
        System.out.println(new String(message.getBody()));
    }
}
